﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WorkStation.Frameworks.EasyBus;
using WorkStation.Frameworks.EasyBus.MessageQueue;
using WorkStation.Frameworks.EasyBus.Serializable;

namespace WorkStation.Frameworks.EasyBus.Extensions
{
    public static class IEndpointExtensions
    {
        public static string ToEndpointString(this IEndpoint endpoint) 
        {
            return ServiceContainer.Current.GetAllInstances<IQueueAddressTranslator>().Select(v => v.EndpointToString(endpoint)).FirstOrDefault(v => v != null);
        }
    }
}
